package com.facade.utils;

import org.hibernate.criterion.Order;
import org.primefaces.model.SortOrder;

public class UtilsFacade {

	public static Order convertSortOrderToOrder(SortOrder sortOder,
			String sortField) {

		if (sortField != null && !sortField.equals("")) {
			if (sortOder.toString().equals(SortOrder.ASCENDING.toString())) {
				return Order.asc(sortField);
			} else {
				return Order.desc(sortField);
			}
		}
		return null;
	}
}
